<pre>
<?php
function cmp( $a, $b ) 
{
   if ($a == $b) {
       return 0;
   }
   return ($a < $b) ? -1 : 1;
}

function cmpNums( $a, $b )
{
   return ($a - $b);
}

$a = array( 4, 5, 1, 2, 3 );
usort( $a, "cmpNums" );

foreach ($a as $key => $value) {
   echo "$key: $value\n";
}
?>
</pre>
